package jmine.tec.extensions.forms;

import java.util.List;

import jmine.tec.rpc.common.annotation.RestDefinition;

/**
 * Handler of forms
 * 
 * @author lundberg
 * @param <F> form type
 */
@RestDefinition
public interface FormHandler<F> {

    /**
     * Validates a form, checking if it's parameters are correct.
     * 
     * @param form form
     * @return list of validation errors
     */
    List<String> validate(F form);

    /**
     * Applies a form, making it's changes effective
     * 
     * @param form form
     */
    void apply(F form);

    /**
     * @return returns the form class.
     */
    Class<F> formClass();
}
